<template>
  <div>
    <!-- 头部 -->
    <home-header :lableList="this.catalog" v-on:theRouter="theRouter"/>

    <div style="width: 100%;">
      <iframe :src="this.url" style="height: 100vh;margin: 0 auto;width: 100%;">

      </iframe>
    </div>

  </div>
</template>

<script>
  import  HomeHeader from '@/common/components/header'
  import MenuApi from '@/api/menuApi'
  import Encrypt from '@/common/utils/encrypt'
  import mixins from '@/mixins'
  import { equipURL } from '@/common/config'
  export default{
    mixins:[mixins],
    // 后台首页
    name:"Home",
    data(){
      return{
        url:equipURL+'/index.html?token=',
        // url:'http://192.168.0.100:8082/index.html?token=',
        catalog:[],
        menuList:[],
        //点击对象下的子数据
        clickData:[],
      }
    },
    components:{
      HomeHeader,
    },
    created() {
        MenuApi.menuList().then(res => {
          this.catalog = res.data.data.children
          var index = Encrypt.decryptCBC(localStorage.getItem("activeIndex"))
          // 获取到激活的下标
          this.menuList = this.catalog[index].children
        })

        // 获取token
        var token = localStorage.getItem("utoken")
        this.url = this.url + token
        // console.log(this.url)
    },
    methods:{
      // 从header获取到点击对象
      // 传递的index
      theRouter(itemChildren){

        this.menuList = this.catalog[itemChildren].children
        // console.log(this.menuList)
      },
    }
  }
</script>

<style>
</style>
